<template>
    <section class="watchSection">
        <layout :isVertical="true">
            <common-toolbar text="操作日志">
                <!-- <el-button class="btn commonButton" type="default" @click="dialogVisible=true">筛选</el-button> -->
                <!-- <el-button class="btn commonButton" type="default" @click="getShanxuan">筛选</el-button> -->
            </common-toolbar>
            <layout layout="center"  class="centerSection noScrollSection">
                <el-table
                        :data="data"
                        v-loading.iTable="loading"
                        :stripe="true"
                        ref="mutipleTable"
                        :height="height"
                        :highlight-current-row="true"
                        border
                        :tree-props="{children: 'children'}"
                        row-key="id"
                        header-row-class-name="tableHeader"
                        tooltip-effect="dark"
                        class="watchTable"
                        style="width: 100%">
                    <el-table-column
                            label="No."
                            type="index"
                            :index="indexMethod"
                            width="50">
                    </el-table-column>
                    <el-table-column
                            property="operationTime"
                            label="操作时间"
                    >
                    </el-table-column>
                    <el-table-column
                            property="userName"
                            label="操作账户"
                            >
                    </el-table-column>
                    <el-table-column
                            property="fullName"
                            label="操作人姓名"
                            width="160">
                    </el-table-column>
                    <el-table-column
                            property="ip"
                            label="IP 地址">
                    </el-table-column> 
                   <el-table-column
                            property="description"
                            label="具体操作信息 ">
                    </el-table-column> 
                    <!-- <el-table-column label="操作" width="200">
                       <template slot-scope="scope">
                           <inner-button text="影院接入" @click="showDetail(scope.row)"></inner-button>
                           <inner-button text="账号设置" @click="showDetail2(scope.row)"></inner-button>
                       </template>
                   </el-table-column> -->
                </el-table>
                <div class="paginationDiv">
                    <el-pagination
                            background
                            layout="prev, pager, next"
                            @current-change="handleCurrentChange"
                            :page-size="pageSize"
                            :total="total">
                    </el-pagination>
                </div>
            
            </layout>
        </layout>
    </section>
</template>

<script lang="ts">
import Vue from 'vue';
import Component from 'vue-class-component';
import {JSEncrypt} from 'jsencrypt';
import base from '@/scrollLoad';
import moment from 'moment';
import Service from './log.service';
@Component
export default class cinemaShowLog extends Vue{
    height = 500;
    windowHeight = 700;
    loading = false;
    data = [];
    onlyShowError = false;
    total = 0;
    page = 1;
    pageSize = 30;
    cinemaName = '';
    cinemaCode = '';

    dialogVisible = false;
    form = {
        name: '',
        code: '',
        date : ''
    };
    constructor(){
        super();

    };
    // 序号
    indexMethod(index) {
    return (this.page - 1) * this.pageSize + index + 1;
    }
    searchErrorList(){
        // this.searchList();
         this.$router.push({
                path:'/set/userManagement/newManagement',
                name:'总部管理'
            })
    }

    searchAllList(){
        this.onlyShowError = false;
        this.searchList();
    }

    searchList(){
        let params = {
            pageNum: this.page,
            pageSize: this.pageSize,
        }
        //console.log(params)
        this.loading=true;
        Service.logPage(params).then(res=>{
             if(res.data.succeeded){
                this.data = res.data.data;
                this.total = res.data.totalRecords;
                this.loading=false;
            }else{
                this['$message']({
                    message: res.data.errorMessage,
                    type: 'error'
                });
                this.loading=false;
            }
        })
    }

    handleSizeChange(val) {
        this.pageSize = val;
        this.searchList();
    }

    handleCurrentChange(val) {
        this.page = val;
        this.searchList();
    }

    showDetail(row){
         let params = {
                headquartersCode: row
            };
            window.localStorage.setItem('headquartersCode',JSON.stringify(row))
            this.$router.push({
                path:'/set/userManagement/managementList',
                name:'影院接入',
                params:params
            })
    }
showDetail2(row) {
    let params = {
                id: row.id
            };
             window.localStorage.setItem('headquartersCode',JSON.stringify(row))
            this.$router.push({
                path:'/set/userManagement/accountNumber',
                name:'账号设置',
                params:params
            })
}
    dateFormat(date){
        return moment(date).format("YYYY-MM-DD,H:m:s");
    }

    resizeEvent(){
        this.windowHeight = document.documentElement.clientHeight;
        this.height = this.windowHeight - 210;
    }

    created(){
        const me = this;
        this.resizeEvent();
        this.searchList();
        window.onresize = () => {
            return (() => {
                me.resizeEvent();
            })()
        };
    };
    mounted(){

    };

}
</script>
<style lang="scss" scoped>
    // @import '../../styles/login.scss';

</style>